
layui.use(['table','laydate'],function(){


     $ = layui.jquery;
    var table = layui.table,
        laydate=layui.laydate;

    laydate.render({
       elem: "#oTime",
        type:"date",
        format:"yyyy-MM-dd HH:mm:ss"
    });

    laydate.render({
        elem: "#oEndtime",
        type:"date",
        format:"yyyy-MM-dd HH:mm:ss"
    });

    //用户列表
    var tableIns=table.render({

        elem: '#orderInfo',
        url : '/sharepark/platform/order',
        page : true,
        height : "full-100",
        limits : [10,15,20,40],
        limit : 10,
        id : "orderInfo",
        text:{none:'暂无相关数据'},
        cols : [[
            {type: "checkbox", fixed:"left", width:50},
            {field: 'oNumber', title: '订单编号', sort:true, align:"center"},
            {field: 'carName', title: '车主姓名', align:"center",templet: '<div>{{d.userInfoCar.uName}}</div>'},
            {field: 'carTel', title: '车主电话',  align:"center",templet: '<div>{{d.userInfoCar.uTel}}</div>'},
            {field: 'carparkName', title: '车位主姓名', align:"center",templet: '<div>{{d.userInfoCarpark.uName}}</div>'},
            {field: 'carparkTel', title: '车位主电话',  align:"center",templet: '<div>{{d.userInfoCarpark.uTel}}</div>'},
            {field: 'oTime', title: '开始时间', sort:true, align:"center"},
            {field: 'oEndtime', title: '结束时间', sort:true, align:"center"},
            {field: 'oStatus', title: '订单状态', sort:true, align:"center"},
            {field: 'oTotalmoney', title: '消费金额', sort:true, align:"center"},
            {field: 'price', title: '平台方提成', sort:true, align:'center',templet: '<div>{{d.oTotalmoney*d.sSystem}}</div>' },
        ]]
    });

    //搜索
    $(".search_btn").on("click",function(){

        tableIns.reload({
            where: {
                "userInfoCar.uName": $('#carName').val(),
                "userInfoCarpark.uName":$('#carparkName').val(),
                "oTime":$('#oTime').val(),
                "oEndtime":$('#oEndtime').val()

            }
            ,page: {
                curr: 1 //重新从第 1 页开始
            }
        });

    });


})

